package com.yvon.maple.service.system.service;

import com.yvon.boot.mybatis.IBaseService;
import com.yvon.maple.service.system.dto.RolePermissionDTO;
import com.yvon.maple.service.system.entity.RolePermission;
import com.yvon.maple.service.system.vo.RoleResourceVo;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @author : Yvon
 * @since : 2021-09-27
 */
public interface RolePermissionService extends IBaseService<RolePermission> {
    boolean save(Long roleId, Collection<Long> permissionIds);

    boolean update(Long roleId, Collection<Long> permissionIds);

    List<RolePermissionDTO> getByRoleId(Long roleId);

    Map<Long, List<RolePermissionDTO>> getByRoleIds(Collection<Long> roleIds);

    boolean removeByRoleIds(Collection<Long> roleIds);

    boolean removeByPermissionIds(Collection<Long> permissionIds);

    /**
     * 查询后端资源
     *
     * @return List<BackendResourceVo>
     * @author : Yvon / 2022-05-07
     */
    List<RoleResourceVo> getRoleResource();

    /**
     * 通过用户id查询权限Code
     *
     * @param userId 用户id
     * @return {@link List}<{@link String}>
     */
    List<String> getPermsByUserId(Long userId);
}
